import time
import os.path
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

path = os.path.join(os.path.abspath(os.path.dirname('第2题')), 'html','注册B.html')
driver = webdriver.Chrome()
driver.get(path)
selectB = driver.find_element(By.ID,"selectB")
select = Select(selectB)
time.sleep(2)
select.select_by_index(1)
time.sleep(2)
select.select_by_value('gz')
time.sleep(2)
select.select_by_visible_text('上海B')

time.sleep(2)
driver.quit()